#########################################​######################################
# @file CMakeLists.txt
#
# @details Algorythm_UTTests source project CMake file.
#
# @if REVISION_HISTORY_INCLUDED
# @par Edit History
# @li zhalat 23-SEP-2014 Initial revision of file.
# @endif
#
# @par Copyright (c) 2014 HalSoft
#
# @ingroup:
#
#########################################​######################################

cmake_minimum_required( VERSION 2.6 )

# Define project name
project( Algorythm_UTTests )

# Additional CXX flags
set( ${PROJECT_NAME_UPPERCASE}_CXX_FLAGS -std=gnu++0x -mno-align-double )

# Additional test definitions
add_definitions( 
    -DUNIT_TEST 
)

# Set project root
set( CMAKE_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR} )

# Set path directories
set( BITREE "${CMAKE_PROJECT_ROOT}/UnitTest_BiTree" )
set( AVLTREE "${CMAKE_PROJECT_ROOT}/UnitTest_AvlTree" )
set( CPPUNIT_INC "${CMAKE_PROJECT_ROOT}/../../../cppunit_win/cppunit-1.12.1/cppunit-1.12.1/include" )
set( CPPUNIT_LIB "${CMAKE_PROJECT_ROOT}/../../../cppunit_win/cppunit-1.12.1/UnitCppLibrary/MyCppUnitStaticLibrary/Debug" )

# Define Sources
set( ${PROJECT_NAME_UPPERCASE}_SRC
    # Unit under test
    #"${CMAKE_CURRENT_SOURCE_DIR}/../Algorythm_SRC/Headers/AvlTree.hpp
    #"${CMAKE_CURRENT_SOURCE_DIR}/../Algorythm_SRC/Headers/BiTree.hpp
    # Unit test
    "${BITREE}/BiTree_TestSuite.cpp"
    "${AVLTREE}/AvlTree_TestSuite.cpp"
    # Support classes
    "${BITREE}/BiTree_TestSuite_helper.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
    # Stubs
)

# Define the path to the includes
set( ${PROJECT_NAME_UPPERCASE}_INCLUDE
    "${CMAKE_CURRENT_SOURCE_DIR}"
    "${BITREE}"
    "${AVLTREE}"
    "${CMAKE_CURRENT_SOURCE_DIR}/../Algorythm_SRC/Headers"
    "${CPPUNIT_INC}"
)

include_directories( ${${PROJECT_NAME_UPPERCASE}_INCLUDE} )
add_executable( Algorythm_UTTests ${${PROJECT_NAME_UPPERCASE}_SRC} )

#External library:
add_library( libMyCppUnitStaticLibrary STATIC IMPORTED )
set_target_properties( libMyCppUnitStaticLibrary PROPERTIES IMPORTED_LOCATION "${CPPUNIT_LIB}/libMyCppUnitStaticLibrary.a" )
TARGET_LINK_LIBRARIES( Algorythm_UTTests libMyCppUnitStaticLibrary )